package controller

import (
	"GO/common"
	"GO/model"
	"net/http"

	"github.com/gin-gonic/gin"
)

func GetUserList(c *gin.Context) {
	var user_list []model.User_list
	account, _ := c.Get("account")
	db := common.GetDB()
	//执行SQL语句，来查询用户列表的信息
	if err := db.Raw("SELECT id,username,class,status FROM user_information WHERE NOT account = ? ORDER BY id", account).Scan(&user_list); err.Error != nil {
		c.JSON(http.StatusOK, gin.H{
			"status": 400,
			"err":    err,
		})
		return
	}
	c.JSON(http.StatusOK, gin.H{
		"status": 200,
		"data":   user_list,
	})
}
